home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™94 / Talks & Papers / Timothy Knox / yerk 3.66 / Module source / date < prev    next >
Text File  |  1994-06-24  |  1KB  |  45 lines

  1. \ Date - Date/time support
  2. \ 01/15/85   cbd  Version 1
  3. \ 03/11/87   rfl  ability to put any date in and print it
  4. \                  also changed basicstr to bytes
  5. Decimal
  6.  
  7. \ ( secs dtRec -- )
  8.  Create secs2date   popA0  popD0 $ a9c6 w, next, 
  9.  
  10.  : dig2   0 <# # # #>  type  ; 
  11.  
  12.  :CLASS  DateTime  <Super Object
  13.  
  14.     Int         Year
  15.     Int         Month
  16.     Int         Day
  17.     Int         Hour
  18.     Int         Minute
  19.     Int         Second
  20.     Int         dayOfWeek
  21.     22 bytes    dayNames
  22.  
  23.     \ get the system date and time 
  24.     :M  GET:   $ 20c -base  @ (abs)  secs2date   ;M
  25.  
  26.     :M  PUT: (abs) secs2date ;M
  27.  
  28.     :M  PRINTDAY:   get: dayOfWeek 1- 3 * addr: dayNames  + 
  29.          3  type  ;M 
  30.  
  31.     :M  PRINTDATE:    get: month dig2  ascii / emit 
  32.         get: day dig2 ascii / emit
  33.         get: year 1900 - dig2   ;M
  34.  
  35.     :M  PRINTTIME:   get: hour  dig2 ascii : emit 
  36.          get: minute dig2  ascii : emit get: second dig2  ;M
  37.  
  38.     :M  classINIT: " SunMonTueWedThuFriSat" addr: dayNames swap cmove  ;M
  39.   
  40.     :M  PRINT:  printday: self space   printdate: self   
  41.            2 spaces printtime: self  ;M
  42. ;CLASS
  43.  
  44. dateTime  sysDate
  45.